#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'Dell'
__mtime__ = '2018-01-04'
# code is far away from bugs 
"""

import urllib2

request = urllib2.Request("http://www.xxxxx.com")
try:
    urllib2.urlopen(request)
except urllib2.HTTPError, e:
    print(e.code)
except urllib2.URLError, e:
    if hasattr(e, "reason"):
        print(e.reason)
else:
    print("OK")
